package cn.ssj.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class MyWebConfigure extends WebMvcConfigurerAdapter {

    @Value("web.upload-location")
    private  String myResourcelLocation;
    @Value("web.upload-handler")
    private  String myResourceHandler;
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        System.out.println(myResourcelLocation);
//        System.out.println(myResourceHandler);
        registry.addResourceHandler(myResourcelLocation+"**").addResourceLocations("file:"+myResourceHandler);
        super.addResourceHandlers(registry);
    }
}
